home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / ODF Release 3 / ODFDev / Table / Sources / Content.h < prev    next >
Encoding:
Text File  |  1996-12-16  |  7.4 KB  |  257 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Content.h
  4. //    Release Version:    $ ODF 3 $ 
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef CONTENT_H
  11. #define CONTENT_H
  12.  
  13. #ifndef FWCONTNT_H
  14. #include "FWContnt.h"
  15. #endif
  16.  
  17. #ifndef CELL_H
  18. #include "Cell.h"
  19. #endif
  20.  
  21. #ifndef CONSTANT_H
  22. #include "Constant.h"
  23. #endif
  24.  
  25. #ifndef PROXY_H
  26. #include "Proxy.h"
  27. #endif
  28.  
  29. //========================================================================================
  30. //    Forward Declarations
  31. //========================================================================================
  32.  
  33. class CTablePart;
  34. class CTableProxy;
  35. class FW_CView;
  36. class FW_CMouseEvent;
  37.  
  38. //========================================================================================
  39. //    class CTablePartContent
  40. //========================================================================================
  41.  
  42. class CTablePartContent : public FW_CContent
  43. {
  44.   public:
  45.   
  46.     FW_DECLARE_AUTO(CTablePartContent)
  47.     
  48.     friend class CTableProxysIterator;
  49.     
  50. //----------------------------------------------------------------------------------------
  51. //    Initialization/Destruction
  52. //
  53. public:    
  54.     CTablePartContent(Environment* ev, CTablePart* part);
  55.     virtual ~CTablePartContent();
  56.  
  57. //----------------------------------------------------------------------------------------
  58. //    Inherited API
  59. //
  60.     virtual void                    ExternalizeKind(Environment* ev,
  61.                                             ODStorageUnit* storageUnit, 
  62.                                             FW_CKind* kind,
  63.                                             FW_StorageKinds storageKind,
  64.                                             FW_CPromise* promise,
  65.                                             FW_CCloneInfo* cloneInfo);
  66.     virtual FW_Boolean                InternalizeKind(Environment* ev,
  67.                                             ODStorageUnit* storageUnit, 
  68.                                             FW_CKind* kind,
  69.                                             FW_StorageKinds storageKind,
  70.                                             FW_CCloneInfo* cloneInfo);
  71.                                                       
  72.     virtual FW_MProxy*                IsDataOnlyOneProxy(Environment* ev) const;
  73.                                     
  74. //----------------------------------------------------------------------------------------
  75. //    New API
  76. //
  77. public:
  78.     // ----- Hit testing -----
  79.     ETableLoc                HitTest(Environment* ev, 
  80.                                  const FW_CMouseEvent& theMouseEvent,
  81.                                  FW_CView* view,
  82.                                   CCell& cell) const;
  83.     ETableLoc                HitTest(Environment* ev, 
  84.                                   const FW_CPoint& where,
  85.                                   CCell& cell) const;
  86.  
  87.     // ----- Resizing -----
  88.     void                Resize(Environment* ev, 
  89.                                 const CCell& cell, 
  90.                                 ETableLoc tl, 
  91.                                 const FW_CPoint& delta);
  92.     void                UpdateExtent(Environment* ev);                      
  93.     
  94.     // ----- Add/Remove proxys -----
  95.     void                AddProxy(CTableProxy* proxy);
  96.     void                RemoveProxy(CTableProxy* proxy);
  97.     
  98.  
  99.     void                AddEmbeddedFrameOrPart(Environment* ev, 
  100.                                     const CCell& cell,
  101.                                     FW_CEmbeddingFrame* scopeFrame,
  102.                                     ODPart* embeddedPart, 
  103.                                     ODFrame* embeddedFrame,
  104.                                     ODShape* suggestedShape,
  105.                                     ODTypeToken viewType);
  106.                                                 
  107.     // ----- Getters/setters -----
  108.     const CCell&        GetMaxRowCol() const
  109.                             {return fMaxRowCol;}
  110.     
  111.     FW_Fixed            GetCellSize(short c, FW_XYSelector direction) const;
  112.     FW_Fixed            GetWidth (short c) const;
  113.     FW_Fixed            GetHeight(short r) const;
  114.     
  115.     void                SetWidth (short c, FW_Fixed w);
  116.     void                SetHeight(short r, FW_Fixed h);
  117.     
  118.     // ----- Coordinates from cell -----
  119.     void                FindCell(const FW_CPoint& where, CCell& cell) const;
  120.     
  121.     FW_Fixed            FindLocation(short c, FW_XYSelector direction) const; 
  122.     FW_Fixed            FindLeft(short col) const;
  123.     FW_Fixed            FindTop (short row) const;
  124.     
  125.     void                FindRect(const CCell& cell,
  126.                                  FW_CRect& rect)  const;
  127.                           
  128.     // ----- Cell -> proxy
  129.     CTableProxy*        CellToProxy(const CCell& cell) const;
  130.  
  131.     FW_CPoint            GetExtent() const
  132.                             {return fExtent;}
  133.     
  134.                             
  135.     void                AllocateArrays();
  136.     void                DisposeArrays();
  137.                         
  138. //----------------------------------------------------------------------------------------
  139. //    Data Members
  140. //
  141. protected:
  142.     CTablePart*                                fTablePart;
  143.     CTableProxyCollection*                    fProxys;
  144.     
  145.     // ----- Current size in memory -----
  146.     CCell                                    fMaxRowCol;        
  147.     FW_CPoint                                fExtent;
  148.     
  149.     // ----- Width and height of cells -----
  150.     FW_Fixed*                                fWidth;
  151.     FW_Fixed*                                fHeight;
  152. };
  153.  
  154. //========================================================================================
  155. // class CTableProxysIterator
  156. //========================================================================================
  157.  
  158. class CTableProxysIterator : public CTableProxyCollectionIterator
  159. {
  160. public:
  161.     FW_DECLARE_AUTO(CTableProxysIterator)
  162.     
  163.     CTableProxysIterator(CTablePartContent* content) :
  164.         CTableProxyCollectionIterator(content->fProxys){}
  165.     ~CTableProxysIterator() {}
  166. };
  167.  
  168. //========================================================================================
  169. //    class CTableSelectionContent
  170. //========================================================================================
  171.  
  172. class CTableSelectionContent : public FW_CContent
  173. {
  174.   public:
  175.   
  176.     FW_DECLARE_AUTO(CTableSelectionContent)
  177.     
  178. //----------------------------------------------------------------------------------------
  179. //    Initialization/Destruction
  180. //
  181. public:    
  182.     CTableSelectionContent(Environment* ev, CTablePart* part, CTablePartContent* content);
  183.     virtual ~CTableSelectionContent();
  184.  
  185. //----------------------------------------------------------------------------------------
  186. //    Inherited API
  187. //
  188. public:    
  189.     virtual FW_MProxy*        IsDataOnlyOneProxy(Environment* ev) const;
  190.  
  191.     virtual void            ExternalizeKind(Environment* ev,
  192.                                         ODStorageUnit* storageUnit, 
  193.                                         FW_CKind* kind,
  194.                                         FW_StorageKinds storageKind,
  195.                                         FW_CPromise* promise,
  196.                                         FW_CCloneInfo* cloneInfo);
  197.  
  198.     virtual FW_Boolean        InternalizeKind(Environment* ev,
  199.                                         ODStorageUnit* storageUnit, 
  200.                                         FW_CKind* kind,
  201.                                         FW_StorageKinds storageKind,
  202.                                         FW_CCloneInfo* cloneInfo);
  203.  
  204.     virtual void            IncorporateEmbeddedFrame(Environment* ev, 
  205.                                         FW_CEmbeddingFrame* scopeFrame,
  206.                                         ODFrame* embeddedFrame,
  207.                                         ODShape* suggestedShape,
  208.                                         ODTypeToken viewType);
  209.     virtual void            IncorporateEmbeddedPart(Environment* ev, 
  210.                                         FW_CEmbeddingFrame* scopeFrame,
  211.                                         ODPart* embeddedPart, 
  212.                                         ODShape* suggestedShape,
  213.                                         ODTypeToken viewType);
  214.  
  215.     virtual ODShape*        AcquireSuggestedFrameShape(Environment* ev);
  216.  
  217. //----------------------------------------------------------------------------------------
  218. //    New API
  219. //
  220. public:    
  221.     // ----- Getters/Setters -----
  222.     CCell                    GetCell() const;
  223.     void                    SetCell(const CCell& cell);
  224.  
  225.     CTableProxy*            GetSelectedProxy(Environment* ev) const;
  226.     
  227. //----------------------------------------------------------------------------------------
  228. //    Data Members
  229. //
  230. private:
  231.     CTablePartContent*        fTableContent;
  232.     CTablePart*                fTablePart;
  233.     CCell                    fCell;    
  234. };
  235.  
  236. //========================================================================================
  237. //    Inlines
  238. //========================================================================================
  239.  
  240. //----------------------------------------------------------------------------------------
  241. //    CTableSelectionContent::GetCell
  242. //----------------------------------------------------------------------------------------
  243. inline CCell CTableSelectionContent::GetCell() const
  244. {
  245.     return fCell;
  246. }
  247.  
  248. //----------------------------------------------------------------------------------------
  249. //    CTableSelectionContent::SetCell
  250. //----------------------------------------------------------------------------------------
  251. inline void CTableSelectionContent::SetCell(const CCell& cell)
  252. {
  253.     fCell = cell;
  254. }
  255.  
  256.  
  257. #endif